package com.mew.slots.core.game.hrljj.service;

import com.mew.common.entity.game.WinFree;
import com.mew.slots.core.common.game.BaseGameService;
import com.mew.slots.core.common.game.vo.BasePlayMsgs;
import com.mew.slots.core.common.messge.response.SlotsPlayResponseMessage;
import com.mew.slots.core.common.vo.StrategyGameVO;
import com.mew.slots.core.game.hrljj.bo.HrljjPlayMsgs;
import com.mew.slots.core.game.hrljj.message.HrljjResponseMessage;
import com.mew.slots.core.game.hrljj.roller.HrljjXml;
import com.mew.slots.core.game.hrljj.room.HrljjRoom;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author Dylin
 */
@Service
@Slf4j
public class HrljjService extends BaseGameService {
    @Override
    public BasePlayMsgs startGame(StrategyGameVO player) {
        HrljjRoom room = new HrljjRoom();
        room.init(player.getRollerId(), HrljjXml.getInstance(),player.getWinFree().getFrees()>0,player.getInBetNumber(),player.getControlType());
        room.roundPlay();
        return room.getRes();
    }

    @Override
    public SlotsPlayResponseMessage myResp(WinFree winFree, BasePlayMsgs res) {
        HrljjResponseMessage message = new HrljjResponseMessage();
        HrljjPlayMsgs pmres = (HrljjPlayMsgs) res;
        message.setBonus(pmres.getBouns());
        message.setW2(pmres.getW2());
        message.setW4(pmres.getW4());
        winFree.setBounsNumber(pmres.getBouns());
        return message;
    }
    @Override
    public void myAfterResp(SlotsPlayResponseMessage message,StrategyGameVO player, BasePlayMsgs res) { }
}
